package com.ilearn.ywhn.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @Project: cmcchq
 * @Description:
 * @Version 1.0
 * @Throws :
 * @Author: <li>2019/6/27 lyndon Create 1.0
 * @Copyright (c)2019-2019 版权所有
 * @Modified By:
 */
@Configuration
public class TaskExecutor {

    @Bean
    public AsyncTaskExecutor defaultTaskExecutor() {
        return new ExceptionHandlerAsyncTaskExecutor(new ThreadPoolTaskExecutor());
    }

    @Bean
    public AsyncTaskExecutor defaultTaskScheduler() {
        return new ExceptionHandlerAsyncTaskExecutor(new ThreadPoolTaskScheduler());
    }


}
